package com.nova.bluetooth.adapter;

import android.widget.CheckBox;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.nova.bluetooth.R;
import com.nova.bluetooth.bean.SupportFunctionBean;

public class AddDeviceConfigAdapter extends BaseQuickAdapter<SupportFunctionBean, BaseViewHolder> {


    public AddDeviceConfigAdapter() {
        super(R.layout.item_add_device_config);
        addChildClickViewIds(R.id.radio_option1);
    }


    @Override
    public void onBindViewHolder(@NonNull BaseViewHolder holder, int position) {
        super.onBindViewHolder(holder, position);
        SupportFunctionBean s = getItem(position);
        CheckBox checkBox = holder.getView(R.id.radio_option1);
        checkBox.setClickable(!s.isRequired());
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, SupportFunctionBean s) {
        CheckBox checkBox = baseViewHolder.getView(R.id.radio_option1);
        checkBox.setChecked(s.isCheck());
        checkBox.setText(s.getFunctionName());
    }
}
